<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="lg" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="lg2"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <meta http-equiv="Cache-Control" content="no-siteapp" />
        <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/font.css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript"src="https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/lib/layui/layui.js" charset="utf-8"></script>

    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/xadmin.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/cookie.js"></script>
</head>
  
  <body>
    <div class="x-body">
      <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so">
      <a class="layui-btn layui-btn-small layui-icon layui-icon-refresh-3" style="float:right" href="javascript:location.replace(location.href);" title="刷新">
        </a>
          <input type="text" name="class_name" value="${class_name }" placeholder="请输入培训名称" autocomplete="off" class="layui-input">
          <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
        </form>
      </div>
      <xblock>
        <button class="layui-btn layui-btn-danger" onclick="delAll()"><i class="layui-icon"></i>批量删除</button>
        <button class="layui-btn" onclick="x_admin_show('添加计划','${pageContext.request.contextPath}/train/addplanUI',600,500)"><i class="layui-icon"></i>添加</button>
      	<span class="x-right" style="line-height:40px">总共有${lg2:length(train_plan.list)}条数据 </span>
      </xblock> 
      <table class="layui-table x-admin">
        <thead>
          <tr>
            <th>
              <div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i class="layui-icon">&#xe605;</i></div>
            </th>
            
            <th>培训名称</th>
            <th>培训地点</th>
            <th>培训机构</th>
            <th>培训费用</th>
            <th>培训开始日期</th>
            <th>培训结束日期</th>
            <th>培训课程</th>
            <th>培训人员</th>
            <th width="90xp">操作</th>
          </tr>
        </thead>
        <tbody>
        
        <lg:forEach items="${train_plan.list}" var="tp">
			<tr>
			<td><div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='${tp.plan_id }' ><i class="layui-icon">&#xe605;</i></div></td>
				<td><i class="layui-icon layui-anim layui-anim-rotate layui-anim-loop">&#xe63d;</i>${tp.class_name}</td>
				<td><i class="layui-icon">&#xe715;</i>${tp.train_place}</td>
				<td><i class="layui-icon">&#xe770;</i>${tp.organizer}</td>
				<td><i class="layui-icon">&#xe65e;</i>${tp.train_fee}</td>
				<td><i class="layui-icon">&#xe69c;</i><fmt:formatDate value="${tp.train_start}"/></td>
				<td><i class="layui-icon">&#xe6af;</i><fmt:formatDate value="${tp.train_end}"/></td>
				<td>
					 <a href="${pageContext.request.contextPath}/train/Allcourse?id=${tp.plan_id}"><i class="layui-icon">&#xe609;</i> 查看课程</a>
				</td>
				<td>
					 <a href="${pageContext.request.contextPath}/train/Allstaff?id=${tp.plan_id}"><i class="layui-icon">&#xe60a;</i>查看学员</a>
				</td>
				<td>
					<a href="javascript:;" onclick="x_admin_show('修改计划','${pageContext.request.contextPath}/train/updplanUI?id=${tp.plan_id}',500,250)" ><i class="layui-icon">&#xe642;</i>修改</a>
				</td>
			</tr>
		</lg:forEach>
        </tbody> 
      </table>
        <div class="page">
        <div>
          <a class="prev" href="${pageContext.request.contextPath}/train/list?class_name=${class_name }&startPage=${train_plan.prePage}&PageSize=${train_plan.pageSize}">&lt;&lt;</a> 
          <a class="num" href="${pageContext.request.contextPath}/train/list?class_name=${class_name }&startPage=1&PageSize=${train_plan.pageSize}">首页</a>
          <lg:forEach items="${train_plan.navigatepageNums}" var="na">
          	<lg:if test="${na==train_plan.pageNum}">
         		<span class="current" href="${pageContext.request.contextPath}/train/list?class_name=${class_name }&startPage=${na}&PageSize=${train_plan.pageSize}" style="font-size=16px">${na}</span>
        	</lg:if>
        	<lg:if test="${na!=train_plan.pageNum}">
        		<a class="num" href="${pageContext.request.contextPath}/train/list?class_name=${class_name }&startPage=${na}&PageSize=${train_plan.pageSize}"  >${na}</a>
        	</lg:if>
          </lg:forEach>
          <a class="num" href="${pageContext.request.contextPath}/train/list?class_name=${class_name }&startPage=${train_plan.pages}&PageSize=${train_plan.pageSize}">尾页</a>
          <a class="prev" href="${pageContext.request.contextPath}/train/list?class_name=${class_name }&startPage=${train_plan.nextPage}&PageSize=${train_plan.pageSize}">&gt;&gt;</a> 
          <%-- <lg:forEach end="${staff.total}" begin="1" var="n">
           	<a class="num" href="${pageContext.request.contextPath}/staff/staffList?startPage=${na}">${na}</a>
          </lg:forEach> --%>
          <span>
          <form action="${pageContext.request.contextPath}/train/list?class_name=${class_name }" method="post" >
	         	每页显示数量<input style="width: 30px ; text-align: center" type="text" placeholder="输入展示数量" name="PageSize" value="${train_plan.pageSize}"/>
	         <input value="确定" class="glyphicon glyphicon-refresh" type="submit" />
          </form>
          </span>
        </div>
      </div>
        
    </div>
    <script>

      /*计划-分页*/
      
      /* layui.use('laypage', function(){
    	  
    	  var laypage = layui.laypage;
    	  
    	  //执行一个laypage实例
    	  laypage.render({
    	    elem: 'page', //注意，这里的 test1 是 ID，不用加 # 号
    	    count: '${lg2:length(pageInfo.list)}', //数据总数，从服务端得到
    	    
    	    layout: ['count', 'prev', 'page', 'next', 'limit', 'refresh', 'skip'],
    	    jump: function(obj){
    	        console.log(obj)
    	      }
    	  });
    	}); */
      
	  /*计划-删除*/
      function delAll (argument) {

        var id = tableCheck.getData();
  
        layer.confirm('确认要删除吗？',function(index){
        	
        	$.ajax({
				url:"${pageContext.request.contextPath}/train/delPlan",   
				data:{"id":id.join(",")},
				dataType:"json",
				success:function(data){
            		
            	}
        	});
            //捉到所有被选中的，发异步进行删除
            layer.msg('删除成功', {icon: 1});
            $(".layui-form-checked").not('.header').parents('tr').remove();
        });
      }
    </script>
    <script>var _hmt = _hmt || []; (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
      })();
    </script>
  </body>
</html>